package _struct

import "gitee.com/leeqiang250/go-common/util"

type ResV1 struct {
	Code uint64      `json:"code"`
	Msg  string      `json:"msg"`
	Ts   uint64      `json:"ts"`
	Data interface{} `json:"data"`
}

func ResV1V1(code uint64, msg string, data interface{}) *ResV1 {
	return &ResV1{
		Code: code,
		Msg:  msg,
		Ts:   util.NowMs(),
		Data: data,
	}
}

func ResV1SuccessV1() *ResV1 {
	return ResV1V1(0, "success", nil)
}

func ResV1SuccessV2(data interface{}) *ResV1 {
	return ResV1V1(0, "success", data)
}

func ResV1FailV1() *ResV1 {
	return ResV1V1(1, "fail", nil)
}

func ResV1FailV2(msg string) *ResV1 {
	return ResV1V1(1, msg, nil)
}

func ResV1FailV3(msg string, data interface{}) *ResV1 {
	return ResV1V1(1, msg, data)
}
